package com.cf.common.mvp;


import com.cf.common.mvp.annotation.Presenter;

/**
 * @author yangji
 */
public interface BaseView<P extends BasePresenter> {

    default P createPresenter() {
        Presenter presenter = getClass().getAnnotation(Presenter.class);
        presenter.value().getSimpleName();
        try {
            P p = (P) presenter.value().newInstance();
            p.bindView(this);
            return p;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}
